package com.startit.validation;

import com.startit.csv.CSVField.ValidationType;

public class ValidationFactory {
	public IValidation getValidation(ValidationType type, Object param) {
		try {
			switch (type) {
			case REQUIRED:
				return new RequiredValidation();
			case MAXLENGTH:
				return new MaxLengthValidation((Integer) param);
			case MIN:
				return new MinValidation((Integer) param);
			case MAX:
				return new MaxValidation((Integer) param);
			case MATCH:
				return new MatchValidation((String) param);
			default:
				return null;
			}
		} catch (ClassCastException e) {
			return null;
		}
	}
}
